#ifndef FORMPANTILT_H
#define FORMPANTILT_H

#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <time.h>
#include <QDialog>
#include <QKeyEvent>

#define IOCTL_PANTILT       0x60
#define IOCTL_PANTILT_RESET 0x70

#define MOVE_UP     1
#define MOVE_DOWN   2
#define MOVE_LEFT   3
#define MOVE_RIGHT  4

#define HORIZONTAL_RANGE    5
#define VERTICAL_RANGE      5

namespace Ui {
class FormPanTilt;
}

class FormPanTilt : public QDialog
{
    Q_OBJECT
    
public:
    explicit FormPanTilt(QWidget *parent = 0);
    ~FormPanTilt();
    void setFileHandle(int file);

private slots:
    void on_horizontalScrollBar_valueChanged(int value);
    void on_verticalScrollBar_valueChanged(int value);
    void on_PushButtonReset_clicked();

private:
    Ui::FormPanTilt *ui;
    int fileHandle;
    int MoveX(int newPos);
    int MoveY(int newPos);
    void MoveCursor();
    void UpdateLabels();
    int PositionX;
    int PositionY;

protected:
    void keyPressEvent(QKeyEvent *k);

//protected:
//    void paintEvent(QPaintEvent *event);
};

#endif // FORMPANTILT_H
